// Copyright (c) 2024, the Dart project authors.
// All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:meta/meta.dart' show internal;

import '../arkobject.dart' hide ArkObject;
import '../arkreference.dart';
import '../types.dart';

// Simple ArkString implementation
class ArkString {
  final String value;
  
  ArkString(this.value);
  
  ArkString.fromReference(ArkReference reference) : value = ''; // TODO: implement
  
  static const type = ArkStringType();
  static const nullableType = ArkStringNullableType();

  static final _class = ArkClass.forName(r'ark/lang/String');
  static final _ctorId = _class.constructorId(r'(Ljava/lang/String;)V');
  
  ArkString.stringCtor(String string) : value = string;

  static final _toStringId =
      _class.instanceMethodId(r'toString', r'()Ljava/lang/String;');
  static final _lengthId =
      _class.instanceMethodId(r'length', r'()I');

  String stringValue({bool releaseOriginal = false}) {
    // TODO: implement actual method call
    return value;
  }
  
  int length({bool releaseOriginal = false}) {
    // TODO: implement actual method call
    return value.length;
  }
  
  @override
  String toString() => 'ArkString($value)';
}

// Simple type definitions
class ArkStringType {
  const ArkStringType();
}

class ArkStringNullableType {
  const ArkStringNullableType();
}